[ceph]: skip ceph ops on non-enabled cluster timeout#3947
Open
zstack-robot-1 wants to merge 1 commit into
Open
[ceph]: skip ceph ops on non-enabled cluster timeout#3947zstack-robot-1 wants to merge 1 commit into
zstack-robot-1 wants to merge 1 commit into
Conversation
Skip Ceph secret creation when cluster is not Enabled to prevent reconnect timeout. Add 5-minute await timeout to FutureCompletion to prevent permanent blocking. Resolves: ZSTAC-80275 Change-Id: Iaa61109103cc5b4ee9bf86485e1777456b172b56
概览修改 变更说明集群状态保护与超时管理
代码审查工作量估计🎯 2 (简单) | ⏱️ ~10 分钟 诗
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 1 warning)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
plugin/ceph/src/main/java/org/zstack/storage/ceph/primary/CephKvmExtension.java (1)
82-82: ⚡ Quick win将超时时间提取为具名常量,避免魔法值。
Line 82 直接写
5可读性偏弱,后续调整也容易遗漏;建议提取为类级常量。♻️ 建议修改
public class CephKvmExtension implements KVMHostConnectExtensionPoint, HostConnectionReestablishExtensionPoint { private static final CLogger logger = Utils.getLogger(CephKvmExtension.class); + private static final long SECRET_CREATION_AWAIT_TIMEOUT_MILLIS = TimeUnit.MINUTES.toMillis(5); @@ - completion.await(TimeUnit.MINUTES.toMillis(5)); + completion.await(SECRET_CREATION_AWAIT_TIMEOUT_MILLIS);As per coding guidelines "避免使用魔法值(Magic Value):直接使用未经定义的数值或字符串应替换为枚举或常量。"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@plugin/ceph/src/main/java/org/zstack/storage/ceph/primary/CephKvmExtension.java` at line 82, Replace the magic literal 5 in the completion.await(TimeUnit.MINUTES.toMillis(5)) call by introducing a descriptive class-level constant (e.g., COMPLETION_AWAIT_TIMEOUT_MINUTES or TIMEOUT_MINUTES) in CephKvmExtension and use that constant in the await call (completion.await(TimeUnit.MINUTES.toMillis(COMPLETION_AWAIT_TIMEOUT_MINUTES))); ensure the constant is static final and documented so future adjustments are centralized.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@plugin/ceph/src/main/java/org/zstack/storage/ceph/primary/CephKvmExtension.java`:
- Line 82: Replace the magic literal 5 in the
completion.await(TimeUnit.MINUTES.toMillis(5)) call by introducing a descriptive
class-level constant (e.g., COMPLETION_AWAIT_TIMEOUT_MINUTES or TIMEOUT_MINUTES)
in CephKvmExtension and use that constant in the await call
(completion.await(TimeUnit.MINUTES.toMillis(COMPLETION_AWAIT_TIMEOUT_MINUTES)));
ensure the constant is static final and documented so future adjustments are
centralized.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: http://open.zstack.ai:20001/code-reviews/zstack-cloud.yaml (via .coderabbit.yaml)
Review profile: CHILL
Plan: Pro
Run ID: 426ed645-091f-47b6-b49d-d76d35791157
📒 Files selected for processing (1)
plugin/ceph/src/main/java/org/zstack/storage/ceph/primary/CephKvmExtension.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: ZSTAC-80275
sync from gitlab !9838